package cn.byapps.master.controller;

import java.util.UUID;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import cn.byapps.master.entity.SysUser;
import cn.byapps.master.service.UserService;
import cn.byapps.master.vo.Result;
import lombok.extern.slf4j.Slf4j;

@RestController
@Slf4j
public class UserLoginController {

	@Autowired
	private UserService userService;

	@PostMapping("post/login")
	public Result login(@RequestBody SysUser user) {
		log.info("username = " + user.getUsername());
		log.info("password = " + user.getPassword());
		SysUser sysUser = userService.getByUser(user.getUsername());
		if (sysUser == null) {
			return new Result(0, "111111", "1", null);
		} else {
			return new Result(0, "111111", "1", UUID.randomUUID().toString());

		}

	}

}
